package com.chengfei.thread.demo1;

import java.util.Arrays;
import java.util.List;

/**
 * @author chengfei5
 * @date 2019/1/7
 */
public class NewThread8 {
    public int add (List<Integer> values){
        values.parallelStream().forEach(System.out::println);
        values.parallelStream().forEachOrdered(System.out::println);
        return values.parallelStream().mapToInt(value -> value).sum();
    }

    public static void main(String[] args) {
        List<Integer> values = Arrays.asList(10,20,30,40,50,400);
        int res = new NewThread8().add(values);
        System.out.println(res);
    }
}
